package users;

import ui.MainPage;


/**
 * This class contains the basic essentials of any role that may be
 * assigned in the review system.
 * 
 * @author Aaron Chen
 * @version 2/28/2014
 */
public abstract class AbstractRole implements Role {

  /** The ID of this role in the database. */
  private long my_id;
  
  /** The ID number of the conference that this role is associated with. */
  private long my_conference_id;
  
  /** The user that this role is associated with. */
  private long my_user_id;
  
  /**
   * Constructs a new role for a User to hold.
   * @param the_role_id The ID for this particular role assignment.
   * @param the_user_id The User that this role is assigned to.
   * @param the_conf_id The Conference that this role is assigned in.
   */
  protected AbstractRole(final long the_role_id,
                         final long the_user_id,
                         final long the_conf_id) {
    my_id = the_role_id;
    my_user_id = the_user_id;
    my_conference_id = the_conf_id;
  }
  
  /** 
   * Returns the conference ID. 
   * @return The conference ID.
   */
  public final long getConferenceID() {
    return my_conference_id;
  }
  
  /**
   * Returns the user that this role is associated with.
   * @return The user.
   */
  public final User getUser() {
    return MainPage.getDatabase().accessUser().getUser(my_user_id);
  }
  
  /**
   * {@inheritDoc}
   */
  public final long getID() {
    return my_id;
  }
  
  /**
   * {@inheritDoc}
   */
  public final void setID(final long the_id) {
    my_id = the_id;
  }
  
  /**
   * Returns the ID of the user that this role is associated with.
   * @return The ID of the user.
   */
  public final long getUserID() {
    return my_user_id;
  }
  
}
